import Character from "../Template.js";

function get_stats(maxHp, defense, attack, hp = null) {
    return {
        maxHp: 20,
        defense: 10,
        attack: 10,
        hp: hp ?? maxHp
    }
}

class TraitTemplate {
    constructor(name, desc, _domain) {
        this.name = name;
        this.desc = desc;
        this.domain = _domain ?? function (){
            console.log("特性触发")
            return true;
        };
    }



    before() {

    }

    after() {

    }

    Run() {
        if (this.before()) {
            if (this.domain()){
                this.after()
            }
        } else {
            // TODO 待办
        }
    }
}

export default {
    "remilia": new Character("remilia", "蕾米莉亚·斯卡蕾特", get_stats(12, 2, 3),
        new TraitTemplate("高贵", "触发到高级奇遇的概率+20%")),
    "flandre": new Character("flandre", "芙兰朵露·斯卡蕾特", get_stats(7, 2, 5),
        new TraitTemplate("狂血", "每次获得治疗时，额外恢复20%的治疗量")),
    "demonroot_death": new Character("demonroot_death", "迪斯波琉卡", get_stats(7, 2, 5),
        new TraitTemplate("魔之根源", "对人类属性角色造成3倍的伤害, 人类对自己的伤害削减到1/3(被动)")),
    "config": {
        init_character: ["remilia", "flandre","demonroot_death"]
    }
}